package com.feature50.makeover;

import com.jgoodies.looks.plastic.PlasticXPLookAndFeel;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;

import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public class Bootstrap {
    private static final Logger logger = Logger.getLogger(Bootstrap.class);

    public static DesktopFrame desktopFrame;

    /**
     * A private constructor to prevent instantiation. There's no danger in
     * instantiating this class; this is done to make it clear that Bootstrap is
     * not intended for instantiation.
     */
    private Bootstrap() {}

    public static DesktopFrame getDesktopFrame() {
        return desktopFrame;
    }

    /**
     * The entry-point method; this is where ADvance Desktop starts up.
     *
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        UIManager.setLookAndFeel(new PlasticXPLookAndFeel());

        // turn on log4j
        BasicConfigurator.configure();

        // Display the main window
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                desktopFrame = new DesktopFrame();
                desktopFrame.setSize(1024, 768);
                desktopFrame.setLocationRelativeTo(null);
                desktopFrame.setVisible(true);

                final DashboardPanel dashboard = new DashboardPanel();

                desktopFrame.launchNavApp(new ENode(null, "Dashboard", new AppLauncher() {
                    public JComponent launchApplication(ENode node) {
                        return dashboard;
                    }
                }));
            }
        });
    }
}